var edit_editor1, edit_editor2, edit_editor3, edit_editor4, edit_editor5, edit_editor6, edit_editor7, edit_editor8, edit_editor9, edit_editor10;
var testfd = 1;
$(function(){
	layui.use(['form', 'layedit', 'jquery', 'laydate'], function(){
		var form = layui.form(),layedit = layui.layedit,$ = layui.jquery, laydate = layui.laydate;;
		form.render('checkbox');
	  	//创建编辑器
	  	layedit.set({
		  	uploadImage: {
		    	url: '/upload/image' //接口url
	  		}
		});
	  	$($(".editor")).each(function (i, obj){
	  		var id = $(obj).attr("id");
	  		// var editIndex = layedit.build(id,{height:120});
	  		eval( " edit_"+ id +" ='"+layedit.build(id,{height:120})+"'");
		});

	  	form.on('checkbox(checkbox_all)', function(data){
			$("input[name='ids[]']").attr("checked",data.elem.checked);
			form.render('checkbox');
		});

		form.verify({
	  		username: function(value){
			    if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
		      		return '不能有特殊字符';
			    }
			    if(/(^\_)|(\__)|(\_+$)/.test(value)){
		      		return '首尾不能出现下划线\'_\'';
			    }
			    if(/^\d+\d+\d$/.test(value)){
		      		return '不能全为数字';
			    }
		  	}
		  	,pass: [
				/^[\S]{6,12}$/
				,'密码必须6到12位，且不能出现空格'
		  	]
		  	,tel: function(value){
		  		if(! /\d{3}-\d{8}|\d{4}-\d{7}/.test(value) && ! /^400(-\d{3,4}){2}$/.test(value)){
		      		return '电话号码格式不正确';
			    }
		  	}
		})
		
	});
})